package com.wlz.loadBalance;

import com.wlz.ip.ServerIps;

/**
 * @author： wlz
 * @Date 2020/11/20 11:27
 * @description： TODO 简单随机算法
 * @version: 1.0
 */
public class RandomLoadBalance {

    public static String getServer() {
        // 生成一个随机
        java.util.Random random = new java.util.Random();
        int randomPos = random.nextInt(ServerIps.LIST.size());
        return ServerIps.LIST.get(randomPos);
    }

    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            System.out.println(getServer());
        }
    }
}
